﻿using System;
using System.Linq.Expressions;
using System.Text;

namespace NiuX.Dapper.Visitors;

public class OrderByVisitor : ExpressionVisitor
{
    public StringBuilder ConditionSql = new StringBuilder();


    public void ResolveExpression<T>(Expression<Func<T, int>> exp)
    {
        Visit(exp.Body);
    }

    //protected override Expression VisitBinary(BinaryExpression node)
    //{
    //    ConditionSql.Append("(");
    //    Visit(node.Left);

    //    ConditionSql.Append($" {node.NodeType.TransferExpressionType()} ");

    //    Visit(node.Right);
    //    ConditionSql.Append(")");

    //    return node;
    //}

    protected override Expression VisitMember(MemberExpression node)
    {
        ConditionSql.Append(node.Member.Name);
        return node;
    }
}